Dynomotion

Group: DynoMotion Message: 10564 From: cnc_machines Date: 11/25/2014
Subject: KMotion CNC Screen Modification
Greetings,

I would like to make a few simple changes to the KMotion CNC screen. I only have an X, Y, and A axis and only want those to display.

I see that there is a way to do this. Just wondering if anyone has gone into detail on how this is done?

I copied this from the FAQ page on Dynomotion.

Currently you must use Microsoft's Visual Studio 2008 Standard Edition's Resource Editor to change the Screens.

Thanks,


Scott

Group: DynoMotion Message: 10568 From: Tom Kerekes Date: 11/26/2014
Subject: Re: KMotion CNC Screen Modification
Hi Scott,

First verify you can successfully re-build KMotionCNC from source code:

#1 - install VS 2008
#2 - open the "solution" called <>\PC VC Examples\BuildExamples\BuildExamples.sln
#3 - Right click KMotionCNC and set it as the "Start up" project
#4 - set the Build Configuration as "Release"
#5 - From the Build Menu select "Rebuild KMotionCNC"
#6 - if successful push F5 to run KMotionCNC
#7 - exit KMotionCNC

To Change a screen:

#1 - from the View Menu select Resource View
#2 - Open KMotionCNC | KMotionCNC.rc | Dialogs
#3 - double-click a Dialog to change ie IDD_KMOTIONCNC_6_LATHE_2_AXES
#4 - visually select cells to move/resize or change the cell's properties
#5 - push F5 to compile and run the changed program

HTH
Regards
TK


Group: DynoMotion Message: 10582 From: Tom Kerekes Date: 11/27/2014
Subject: Re: KMotion CNC Screen Modification
Hi Troy,

If you delete a screen button or cell (with the delete key) you would need to remove all the C++ code references to that cell otherwise there will be errors when the program runs.

You can make the cell invisible by turning off the Visible property.  Which has the same effect as deleting it.

Regards
TK


Group: DynoMotion Message: 10583 From: T Day Date: 11/27/2014
Subject: Re: KMotion CNC Screen Modification

This must be why there is some controls behind the gcode area? J (Working with 3 axis resizable). I will simply make them disabled and Visible off, unless there is a simple way to search out all C ++ code references??

 

Curious on 2 things….

Why is it that when I edit the Emergency Stop, Halt/Cycle Start and Feed Hold buttons to align at Top they look fine in VS 2008, but when I launch KmotionCNC the Halt/CycleStart button is placed much lower than the other 2?

 

Can there be a DRO for Command Position and a DRO for Encoder Position on each axis? Any examples I can look at?

 

Thanks again Tom,

Troy

 

From: DynoMotion@yahoogroups.com [mailto:DynoMotion@yahoogroups.com]
Sent: Thursday, November 27, 2014 10:59 AM
To: DynoMotion@yahoogroups.com
Subject: Re: [DynoMotion] KMotion CNC Screen Modification

 

 

Hi Troy,



If you delete a screen button or cell (with the delete key) you would need to remove all the C++ code references to that cell otherwise there will be errors when the program runs.



You can make the cell invisible by turning off the Visible property.  Which has the same effect as deleting it.



Regards

TK



 


From: "tmday
To: DynoMotion@yahoogroups.com
Sent: Thursday, November 27, 2014 6:48 AM
Subject: Re: [DynoMotion] KMotion CNC Screen Modification

 

 

Hi Tom,
 First time tring VS 2008 and modifing a KmotionCNC Screen. Tried your step by step example you posted here, works great. Now how would i delete a button? I see how it can be hidden and set Behavior , Disabled within the object properties, but can a button or any other object be removed/deleted from screen?

Thanks,
Troy

 

Group: DynoMotion Message: 10584 From: Tom Kerekes Date: 11/27/2014
Subject: Re: KMotion CNC Screen Modification
Hi Troy,

I don't recommend deleting the C++ references to deleted cells.  That would be fairly complicated and not provide any benefit to the final result.

The 3-axis resizable has substantial code to move and re-size screen cells based on the positions of the dialog border and neighboring cells.  MFC (Classes KMotionCNC is built on doesn't have a simple way to do this).  A special EasySize Macro is used to assist in re-positioning cells dynamically.  Search the code for:

BEGIN_EASYSIZE_MAP

You should probably stick to changing a Fixed size Dialog.

Regarding Encoder DROs:  I assume you aware that KMotionCNC already has an option to display encoder positions.  I assume you are thinking to display both at the same time.  Adding new controls would require a substancial amount of C++ coding and it would become difficult to update to newer releases as the changes would need to be re-merged each time.  Here are some references to some of the things that would need to be used/modified if you are interested:

CDisplay - this is the class type that makes a DRO generic control

m_PosX - this is an example declared as one instance of CDisplay class that is the current X DRO

SetBigValues - this function updates all the current DROs

SetBigValueColor - helper function to set a DRO color based on all the various options and conditions

if (DisplayedEnc) Disp->SetTextColor(0xFFC000);  - code used to set the DRO color bluish if we are displaying Encoders

Disp0->SetText(s);  - sets the text in the DRO to the string s

HTH
Regards
TK




Group: DynoMotion Message: 10585 From: T Day Date: 11/27/2014
Subject: Re: KMotion CNC Screen Modification

Tom,

 Was only thinking it might make things clearer when in VS 2008, if controls and such was deleted, but the Hide and Disable works and keeps things simple. ;)

 

I will start on a fixed size dialog to keep things simple. J

 

Yes I was after displaying both at same time.

 I haven’t done it before but can the Display Encoder Positions been done on the fly while Gcode is running,safely?

 I simply copied the Show Encoder CheckBox from the ToolSetup dialog to the Main 3 axis dialog. Did not get any errors. (But am at my desktop and not mill machine.) Will this work?

 

J Brain storming here…. Can another screen be added to a main dialog? Example: When I want to use machine manually by turning handwheels, its nice to have nothing on screen beside large axis DROs and spindle control. How difficult is this to add or can a button be made to switch Main dialog Face to another dialog?

 Doing this because my brother(manual machinist) is learning the mill(and CNC) and most of the time its just manually. Have a screen in Mach3 for him that allows this.

 

Thanks,

Troy

 

From: DynoMotion@yahoogroups.com [mailto:DynoMotion@yahoogroups.com]
Sent: Thursday, November 27, 2014 1:01 PM
To: DynoMotion@yahoogroups.com
Subject: Re: [DynoMotion] KMotion CNC Screen Modification

 

 

Hi Troy,

 

I don't recommend deleting the C++ references to deleted cells.  That would be fairly complicated and not provide any benefit to the final result.

 

The 3-axis resizable has substantial code to move and re-size screen cells based on the positions of the dialog border and neighboring cells.  MFC (Classes KMotionCNC is built on doesn't have a simple way to do this).  A special EasySize Macro is used to assist in re-positioning cells dynamically.  Search the code for:

 

BEGIN_EASYSIZE_MAP

 

You should probably stick to changing a Fixed size Dialog.

 

Regarding Encoder DROs:  I assume you aware that KMotionCNC already has an option to display encoder positions.  I assume you are thinking to display both at the same time.  Adding new controls would require a substancial amount of C++ coding and it would become difficult to update to newer releases as the changes would need to be re-merged each time.  Here are some references to some of the things that would need to be used/modified if you are interested:

 

CDisplay - this is the class type that makes a DRO generic control

 

m_PosX - this is an example declared as one instance of CDisplay class that is the current X DRO

 

SetBigValues - this function updates all the current DROs

 

SetBigValueColor - helper function to set a DRO color based on all the various options and conditions

 

if (DisplayedEnc) Disp->SetTextColor(0xFFC000);  - code used to set the DRO color bluish if we are displaying Encoders

Disp0->SetText(s);  - sets the text in the DRO to the string s

 

HTH

Regards

TK

 

 

Group: DynoMotion Message: 10588 From: Tom Kerekes Date: 11/28/2014
Subject: Re: KMotion CNC Screen Modification
Hi Troy,

You can't usually copy cells from one screen to another with out also incorporating the C++ code into the corresponding file that has all the code behind the screen  In the case of the Encoder Checkbox there would be something Microsoft MFC refers to as a Data Exchange between a BOOL Member variable m_DisplayEncoder and the screen cell.  The line:

    DDX_Check(pDX, IDC_DisplayEncoders, m_DisplayEncoder);

would need to be copied from ToolSetupTPPage.cpp (C++ file that handles the Tool Setup Trajectory Planner Dialog) to KMotionCNCDlg.cpp (C++ file that handles the main KMotionCNC Dialog).  This line associates the ID of the screen cell to a BOOL variable in the dialog class.  Both Classes happen to have a variable with the same name.  And if you copied the screen cell it will probably have the same ID.  So you shouldn't need to edit the line.  Previously closing the Tool Setup dialog with "OK" has code to copy the variable's value from the Tool Setup dialog back into the Main Dialog for actual use.

Regarding adding an additional screen.  That would be fairly involved.  You can already switch screen "Faces" with just several mouse clicks.

HTH
Regards
TK

Group: DynoMotion Message: 10593 From: tmday7 Date: 11/28/2014
Subject: Re: KMotion CNC Screen Modification
Tom,
 I tried to Rebuild in VS 2008 today and it showed a Error regarding the Show Encoder Check Box, thought i did a Rebuild last night with no errors.
But, i believe i have copied the line of code to the correct place in the KMotionCNCDlg.cpp C++ file. If i have the Show Encoders Selected on Main Dialog Face, should the Show Encoders check box also show selected on the Trajectory Planner screen?

About changing Main Screen Dialogs from Tool/SetUp files screen,....Can a user button contain code to change the Main dialog Face?

Thanks again,
Troy
Group: DynoMotion Message: 10597 From: Tom Kerekes Date: 11/28/2014
Subject: Re: KMotion CNC Screen Modification
Hi Troy,

Yes it should.  And it should immediately change the DROs.  The current value is located in the Main Dialog Class (CKMotionCNCDlg).  It is restored to there from a disk file on KMotionCNC startup, saved from there on KMotionCNC Exit, and referenced from there by the DROs code.  When the Tool Setup Screen is created a copy of the value is transferred there.  If "ok" is entered on the Tool Setup Screen then the value is copied back.  Otherwise it is discarded.

But I forgot to tell you to add something.  When you select the checkbox on the Main Screen the cell will change but the variable associated with it will not immediately change.  The way most MFC Dialog screens work is that the Operator will alter one or more cells on a screen and then select "OK".  The OK event handler will "UpdateData" to then transfer all the data from the screen cells to all the member variables.  However in this case we want checking the Show Encoders checkbox to have an immediate effect.  So a Message Event must be added and a function must be added to make an Update Data call.  Furthermore to add any function to a class the definition of that function must be added to the class definition in the class header file.  Hint you can model all the changes to do things the same as the current Show Machine Coordinates checkbox does.  So:

To KMotionCNCDlg.h after     afx_msg void OnShowMach();  add a function declaration called:

afx_msg void OnDisplayEncoder();

To KMotionCNCDlg.cpp after     ON_BN_CLICKED(IDC_ShowMach, OnShowMach)  add a message event as:

    ON_BN_CLICKED(IDC_DisplayEncoder, OnDisplayEncoder)

Then after the function:

void CKMotionCNCDlg::OnShowMach()
{
    UpdateData();   
}

add the function:

void CKMotionCNCDlg::OnDisplayEncoder()
{
    UpdateData();   
}


Regarding User Buttons: no there is no current functionality to change Dialog Faces.  That would involve quite a few changes and additions.

Regards
TK

Group: DynoMotion Message: 10599 From: tmday7 Date: 11/29/2014
Subject: Re: KMotion CNC Screen Modification
Hi Tom,

  I tried as you said but when i Rebuild i get the following error.....
1>.\KMotionCNCDlg.cpp(665) : error C2065: 'IDC_DisplayEncoder' : undeclared identifier
1>.\KMotionCNCDlg.cpp(665) : error C2065: 'IDC_DisplayEncoder' : undeclared identifier

Iam still working on this at my desktop PC and no KFLOP board connected to it. Haven't tried any of these changes on my mill machine yet.

"Hint you can model all the changes to do things the same as the current Show Machine Coordinates checkbox does." Meaning, that other controls or functions like Show Encoder control, can be modeled to the Main Dialog Face?

Its amazing to see some of the internal workings of software like this. Truly shows how much hard work goes into it.

Thanks,
Troy
Group: DynoMotion Message: 10600 From: Tom Kerekes Date: 11/30/2014
Subject: Re: KMotion CNC Screen Modification
Hi Troy,

Oops the added code should contain:

IDC_DisplayEncoders

not

IDC_DisplayEncoder

and match the ID property of the cell that you added.

Regards
TK

Group: DynoMotion Message: 10602 From: tmday7 Date: 11/30/2014
Subject: Re: KMotion CNC Screen Modification
Hi Tom,
 Changed it. The cell i added has a id of IDC_DislpayEncoders3 in the properties tree of VS2008.
I dont get a rebuild error if i add IDC_DisplayEncoders or IDC_DislpayEncoders3 to the KMotionCNCDlg.app file.

Tried running KMotionCNC in simulate mode on my desktop. Selected the new Display Encoders on Main Dialog face but the Display Encoders on the TPlanner page does not reflect selection of whats on the Main Dialog Face.
 
I would like to try the changes on my milling machine. What all folders and files do i need to copy from my desktop PC Kmotion directory?

Thanks again,
Troy
Group: DynoMotion Message: 10603 From: Tom Kerekes Date: 12/1/2014
Subject: Re: KMotion CNC Screen Modification
Hi Troy,

It matters that the ID in the Code matches the ID in the properties exactly and not the ID of a cell on a different screen.   I assume those are numerous typos in your post.  Please be more careful.

If the cell doesn't update properly then I wouldn't expect it to work on the target machine either.

Regards
TK


Group: DynoMotion Message: 10606 From: tmday7 Date: 12/1/2014
Subject: Re: KMotion CNC Screen Modification
Hi Tom,
 No typos. When i copied the Display Encoders cell from the TPlanner page to the Main Dialog Page, the ID assisned to it is IDC_DislpayEncoders3. But even when i add this ID to the code the 2 Show Encoders cells do not reflect each others state. Going to recheck my steps with your previous posts and make sure i have not left out something.

Thanks,
Troy
Group: DynoMotion Message: 10609 From: Tom Kerekes Date: 12/1/2014
Subject: Re: KMotion CNC Screen Modification
Hi Troy,

Do you realize that the "p" and the "l" letters are transposed in the word Display in the symbol IDC_DislpayEncoders3.  Normally when you make a copy of a control the compiler adds a number to make it unique and not transpose digits.

Regards
TK

Group: DynoMotion Message: 10612 From: tmday7 Date: 12/1/2014
Subject: Re: KMotion CNC Screen Modification
Ahh, sorry about that totally missed it :(, fingers got out of step. But good news is the code in the file is spelled correct. So in the code it should be IDC_DisplayEncoders3 and not IDC_DisplayEncoders?

Still need to double check all my additions to the header and cpp files to see if i missed something.

Thanks again and ill make sure i slow down on typing code references. :)

Troy
Group: DynoMotion Message: 10613 From: Tom Kerekes Date: 12/1/2014
Subject: Re: KMotion CNC Screen Modification
Hi Troy,

That is actually bad news because it means we didn't find the bug :}

The ID can be anything as long as it is exactly the same everywhere it is referenced.  So make sure the ID in the Cell properties exactly matches the ID in those few lines of code we added.  It is important to have all the IDs of all the cells on one screen to be unique.  But it is ok to have cells on different screens use the same ID if you wish.

Good luck
Regards
TK

Group: DynoMotion Message: 10614 From: tmday7 Date: 12/1/2014
Subject: Re: KMotion CNC Screen Modification
Hay Tom,
You found it! I had to change the ID in the KmotionCNCdlg.app file from DDX_Check(pDX, IDC_DisplayEncoders, m_DisplayEncoder); to DDX_Check(pDX, IDC_DisplayEncoders3, m_DisplayEncoder);

Now the Display Encoders cell on both screens match each others state. :) Hopefully i can take what you taught(and most likely some more learning.) me and apply to some other controls that i would like to add to the Main face. ;)

What all files and folders do i need to copy from my desktop PC to my milling machine PC?

Thanks much again,
Troy
Group: DynoMotion Message: 10615 From: Tom Kerekes Date: 12/1/2014
Subject: Re: KMotion CNC Screen Modification
Hi Troy,

Congratulations!

All you should need to copy is KMotionCNC.exe

Regards
TK

Group: DynoMotion Message: 10618 From: tmday7 Date: 12/2/2014
Subject: Re: KMotion CNC Screen Modification
Hi Tom,
 Trying to give back a little.... I added a folder to maybe help others in customizing Kmotion CNC. There is 2 pdfs of simply quoting your posts and making it a step by step.

I tried new Main face on mill machine :) Boy, i forgot how much nicer KFLOP Trajectory Planner is over Mach3.

Next thing iam working on adding to my Main Dialog face, is the Slow% cell from the TPPage. I have both cells reflecting each others state, but how to add the  "OK" function to the new cell on the Main Dialog face? Does there need to be a Apply button or Enter key function added or?

Thanks again Tom,
Troy
Group: DynoMotion Message: 10619 From: Tom Kerekes Date: 12/2/2014
Subject: Re: KMotion CNC Screen Modification
Hi Troy,

It was very considerate of you to take the time to do that.  I think we created a monster.

Regarding Jog Speed %:  Yes I believe you would need to add an "Apply" button that would convert any value typed into the Screen cell to the main screen member variable m_JogSlowPercent by calling UpdateData();

Additionally the Jog Buttons are told the Jog Speeds and directions when they are created when the Main Dialog is created.  So simply updating the variable wouldn't have any effect on the behavior of the Jog buttons.  The simplest thing to do would be to completely destroy the main dialog and re-create it if the Operator pushes the Apply button.  Add:

            DestroyWindow();
            Create(IDD_KMOTIONCNC_0_ORIGINAL+m_DialogFace);  // put up the real main window

to the Apply Event handler function after the call to UpdataData.  Also if the Operator enters invalid numeric characters, or an invalid value into any Cell, then UpdateData() will pop up an error message, it will highlight the invalid screen cell, and return false indicating an invalid screen cell was detected.  In this case we would not want to recreate the Main Screen.  So the entire Apply handler might be something like:

void CKMotionCNCDlg::OnJogSpeedApply()
{
    if (!UpdateData()) return;  // update variables and check for errors.  Return here if there was an error

    // All screen valuse converted successfully, so re-create the Main Screen using the new values
    DestroyWindow();
    Create(IDD_KMOTIONCNC_0_ORIGINAL+m_DialogFace);  // put up the real main window
}


Regards
TK   

Group: DynoMotion Message: 10622 From: tmday7 Date: 12/2/2014
Subject: Re: KMotion CNC Screen Modification
Hi Tom,
Do we pull the plug on the monster now or keep going? :)

Am i correct on this.....
I need to copy this code from the ToolSetupTPPage.cpp
:
DDX_Text(pDX, IDC_JogSlowPercent2, m_JogSlowPercent);

and add it to KMotionCNCDlg.cpp ?

Then do i make a C program with this "Apply" handler:

void CKMotionCNCDlg::OnJogSpeedApply()
{
    if (!UpdateData()) return;  // update variables and check for errors.  Return here if there was an error

    // All screen valuse converted successfully, so re-create the Main Screen using the new values
    DestroyWindow();
    Create(IDD_KMOTIONCNC_0_ORIGINAL+m_DialogFace);  // put up the real main window
}

and assign it to a User Button?


Thanks,
Troy
Group: DynoMotion Message: 10624 From: Tom Kerekes Date: 12/2/2014
Subject: Re: KMotion CNC Screen Modification
Hi Troy,

Too late to pull the plug, its loose...

Yes that basically sounds correct.

But no, let's use a new special new "Apply" button.  We don't have the capability to assign such special behavior to a User Button.

Using the resource editor make a copy of some Apply button and place it next to the cell with the speed.  Then change the property ID to IDC_JogSpeedApply.

Then add an entry to the Message Table to link that ID to the Function Handler with:

    ON_BN_CLICKED(IDC_JogSpeedApply, OnJogSpeedApply)

whenever a new function to a class is added the function definition also needs to be added to the class definition.  So in KMotionCNCDlg.h add:

    afx_msg void OnJogSpeedApply();

In general I find it difficult to remember all the syntax and places to add or change things to add some new functionality.  So I look for something very similar to what I'm trying to do that already works.  In this case it might be FeedRateApply.  Of course the specialized code to actually change the FeedRate will be completely different (and more complex) than to change the JogSpeed but all the stuff related to declaring a function handler, the message event table, etc will be very similar.  Visual Studio has a nice global find in files search feature (limit the search to within the KMotionCNC project).  So you might use that to search for FeedRateApply to find the places and types of things that need to be added or changed to add Jog Speed Apply functionality.

HTH
Regards
TK 


Group: DynoMotion Message: 10629 From: tmday7 Date: 12/2/2014
Subject: Re: KMotion CNC Screen Modification
Hay Tom!,
 Before you replied i started to do just that "So I look for something very similar to what I'm trying to do that already works." And was using the Spindle Apply codes.
 I actually had everything right!(wow, little scary;)
All i was missing was the...
 ON_BN_CLICKED(IDC_JogSpeedApply, OnJogSpeedApply).

I placed the Apply handler after ....
void CKMotionCNCDlg::OnFeedRateApply()
{
    if (!UpdateData()) return;

    m_FeedSlider.SetPos(m_FeedRateValue);

    Interpreter->CoordMotion->SetFeedRateOverride(m_FeedRateValue);
}

in the KMotionCNCDlg.cpp file. Is this the correct place?

The new cell and Apply button works, but after i click apply the Units change from Inches to MM. Also noticed this every time i start KmotionCNC, that the units default to MM. I vaguely remember this when working with Brad on the WebNC app.What do i have wrong?

Thanks,
Troy
Group: DynoMotion Message: 10642 From: tmday7 Date: 12/4/2014
Subject: Re: KMotion CNC Screen Modification
Hi Tom,
 Been trying to add another User Button to the User Buttons page. Is this doable?
I get no rebuild errors in VS 2008 and KMotionCNC launches but an error happens when i click the Tool Setup button above GCode area. Can you take a look at my list?

In case attachment doesn't work,here is the list of what i added and changed to the .h and .cpp files to add a user button to User Buttons page.
https://groups.yahoo.com/neo/groups/DynoMotion/files/KmotionCNC%20Screen%20Customizing/
File name: Add More User Buttons

Thanks,
Troy

 

  @@attachment@@
Group: DynoMotion Message: 10656 From: Tom Kerekes Date: 12/7/2014
Subject: Re: KMotion CNC Screen Modification [1 Attachment]
Hi Troy,

Did you ever get this working?

But I sort of question the motivation of adding more User Buttons.  The idea of the User Buttons is to allow Users to add custom buttons without the need to change the source code and re-compile.   If you are already changing the source coder then probably simpler and better to just add a new button to the screen.

The User Buttons make use of a thing the source code refers to as an "MCODE_ACTION".  Which is a general data structure which contains information (codes and parameters) in order to define something to do such as run a C Program for example.  The Interpreter (which is a DLL - Dynamically Linked Library)  contains a Table of all these various Actions so that the code can simply make a call to the Interpreter to tell it to look up Action number N from the table and do it.    The Table has Low Numbered M Codes, User Buttons, Higher numbered M Codes (100-119) all packed into one Table in different sections.  When the Tool Setup Screen comes up (which is actually 5 different sub-dialogs), the Interpreter's Table of Actions is distributed to the various dialogs to allow display and editing.  The ugly code below does memory copies to accomplish this:

    memcpy(&Dlg.m_ToolSetupM1Page.McodeActions[0],&Interpreter->McodeActions[0],MAX_MCODE_ACTIONS_M1*sizeof(MCODE_ACTION));
    memcpy(&Dlg.m_ToolSetupButtonsPage.McodeActions[MAX_MCODE_ACTIONS_M1],&Interpreter->McodeActions[MAX_MCODE_ACTIONS_M1],MAX_MCODE_ACTIONS_BUTTONS*sizeof(MCODE_ACTION));
    memcpy(&Dlg.m_ToolSetupM100Page.McodeActions[0],&Interpreter->McodeActions[MAX_MCODE_ACTIONS_M1+MAX_MCODE_ACTIONS_BUTTONS],MAX_MCODE_ACTIONS_M100*sizeof(MCODE_ACTION));
    memcpy(Dlg.m_ToolSetupButtonsPage.UserButtonKeys,m_UserButtonKeys,NUSERBUTTONS*sizeof(int));

Later when the Dialog is closed similar code copies all the data back into to the Interpreter Table.

btw memcopy takes 3 parameters Destination, Source, and number of bytes to copy.  One mismatch in the location or length is likely to crash the program.

So in summary adding more User buttons is messy and you would need to modify the McodeAction table in GCodeInterpreter DLL.  To do this load the Visual Studio Solution BuildAllLibs.sln.

But I'm thinking that is more involved than you might want to go.

HTH
Regards
TK



Group: DynoMotion Message: 10658 From: tmday7 Date: 12/7/2014
Subject: Re: KMotion CNC Screen Modification [1 Attachment]
Hi Tom,
 Thought i "scared" you off with all the customizing questions ;)
No I didnt get it working, tried to for a couple days and figured there was more to it than just  the .h and .cpp files. I did get more familiar with some of the code tho.
 My motivation for more user buttons was that they can have Hot Keys assigned to them. This would make it easy to add physical push buttons/ toggle switches for various controls and inputs by making a custom USB "keyboard" with a Teensy++2.0. :) And not use up KFLOP I/Os.

Can a button be added to the screen as you said and contain a keyboard hotkey function?

Thanks again,
Troy
Group: DynoMotion Message: 10659 From: Tom Kerekes Date: 12/8/2014
Subject: Re: KMotion CNC Screen Modification
Hi Troy,

Yes you can add Hot Keys to Dialog Buttons.  Most of KMotionCNC's buttons have Hot Keys assigned.  For example the esc key is handled with:

    ON_COMMAND(ID_ESC, OnESC)

to associate the Esc key event with the function OnESC which basically calls the Stop Button handler.



An alternate method is used for the User Buttons because those are dynamically assigned to different Keys.  Code is added to the Windows Keyboard Callback Hook Function which is called whenever a key is pressed.  If the key is the assigned key code for a User button then we send a "Command" message to the button on the screen so that it responds as if it was clicked.  See the code fragment below:



LRESULT CALLBACK KbdProc    (   int     nCode,  // hook code
                                WPARAM  wParam, // virtual-key code
                                LPARAM  lParam  // keystroke-message information

                            )
{
    CKMotionCNCDlg *p=&TheFrame->GCodeDlg;

    if (wParam == p->m_UserButtonKeys[0])
    {
        p->SendMessageA(WM_COMMAND,IDC_But0);
    }

Regards
TK

Group: DynoMotion Message: 10661 From: tmday7 Date: 12/8/2014
Subject: Re: KMotion CNC Screen Modification
Hi Tom,
 This looks much simpler:)
Is there a list of key IDs to use? And can you give an example of the ZeroX button using a combination of Key CTRL and Key X?

Thanks
Troy